package uploads_api

import (
	"gin_study_blog/common/http"
	"gin_study_blog/models"
	"gin_study_blog/service/helper"
	"github.com/gin-gonic/gin"
)

// UploadsListView 文件列表
func (UploadsApi) UploadsListView(c *gin.Context) {
	var pg models.PageInfo

	err := c.ShouldBindQuery(&pg)
	if err != nil {
		http.FailWithCode(http.ParamsError, c)
		return
	}

	list, count, err := helper.CommonList(models.BannerModel{}, helper.Option{
		PageInfo: pg,
		Debug:    false,
	})

	if err != nil {
		http.FailWithMessage("获取失败", c)
		return
	}
	http.IsOkWithList(list, count, c)
}
